package cn.com.dcsgo.controller;

import cn.com.dcsgo.result.Result;
import cn.com.dcsgo.security.AuthContextHolder;
import cn.com.dcsgo.service.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * HomeController
 *
 * @author Dcsgo
 * @since 2025/4/24 20:42
 */
@Api(tags = "首页")
@RestController
@RequestMapping("weixin/home")
@RequiredArgsConstructor
public class HomeController {
    private final HomeService homeService;

    @ApiOperation("获取首页数据")
    @GetMapping("index")
    public Result<Map<String, Object>> index() {
        return Result.ok(homeService.getIndexDataByUserId(AuthContextHolder.getUserId()));
    }
}
